/**
 * Copyright (c) 2010-2011 Pierre Labatut
 *
 * This file is part of Space-Chronicles project.
 *
 * Space-Chronicles is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/space-chronicles/>.
 */

package space.model;


import space.stream.StructureInput;
import javax.media.opengl.GL3bc;
import jinngine.math.Matrix4;
import space.gl.RenderContext;

/**
 *
 * @author Pierre
 */
public class MdlEmpty implements Drawable {

    final public String name;
    final public Matrix4 matrix;
    final public String groupName;
    public MdlEmpty(StructureInput di) {
        name = di.readString();
        matrix = di.readObject(Matrix4.class);
        groupName = di.readString();
    }

    public static void drawBasis(GL3bc gl) {
        drawBasis(gl, 1.f);
    }
    public static void drawBasis(GL3bc gl,float length ) {
        
        gl.glBegin(gl.GL_LINES);

        gl.glColor3f(1.f, 0.f, 0.f);
        gl.glVertex3f(0.f, 0.f, 0.f);
        gl.glVertex3f(length, 0.f, 0.f);

        gl.glColor3f(0.f, 1.f, 0.f);
        gl.glVertex3f(0.f, 0.f, 0.f);
        gl.glVertex3f(0.f, length, 0.f);

        gl.glColor3f(0.f, 0.f, 1.f);
        gl.glVertex3f(0.f, 0.f, 0.f);
        gl.glVertex3f(0.f, 0.f, length);

        gl.glEnd();
    }

    public void draw(RenderContext rc) {
        rc.compose(matrix);
        rc.applyLegacyMatrix();
        drawBasis(rc.gl());
    }

     public void debug(GL3bc gl) {      
    }

    public void dispose(GL3bc gl) {
    }

    public Drawable optimize(GL3bc gl) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
